#ifndef VISCOMPONENTSTATE_H
#define VISCOMPONENTSTATE_H

#pragma once

#include <LDF/Utils/Point3f.h>

/**
 * This class holds the state data for a VisComponent class. The data is kept
 * here to allow transitions and manipulation of the VisComponent states.
 * The attributes are public to allow easy and fast access. There is no need to
 * encapsulate them since this class is supposed to live privately inside
 * a VisComponent object only and rarely be accessed by any other class.
 *
 * @author Fabricio Anastacio - fabriciocfa@yahoo.com
 * @since June 25, 2007
 */
class LARGEDISPLAYFRAMEWORKLAYER_API VisComponentState
{
	// Attributes
public:
	/** The position of the center of the component (global - i.e., in relation to screen coordinates). */
	Point3f position;
	/** The rotation angle in radians of the component, giving its orientation. */
	double rotationAngle;
	/** The width of the component */
	unsigned int width;
	/** The height of the component */
	unsigned int height;
	/** The x-coordinate scale factor being applied to the component */
	float scaleFactorX;
	/** The y-coordinate scale factor being applied to the component */
	float scaleFactorY;
	/** The z-coordinate scale factor being applied to the component */
	float scaleFactorZ;
	/** The RGBA color of this component. */
	float color[4];


	// Methods
public:
	VisComponentState(void);
	~VisComponentState(void);

	/**
	 * Assignment operator.
	 *
	 * @param s the VisComponentState object whose values will be assigned to this one.
	 */
	VisComponentState& operator=(const VisComponentState& s) {
		position = s.position;
		rotationAngle = s.rotationAngle;
		width = s.width;
		height = s.height;
		scaleFactorX = s.scaleFactorX;
		scaleFactorY = s.scaleFactorY;
		scaleFactorZ = s.scaleFactorZ;
		color[0] = s.color[0];
		color[1] = s.color[1];
		color[2] = s.color[2];
		color[3] = s.color[3];
		return *this;
	}

	/**
	 * Sets this state as the result of linearly interpolating the source and
	 * target states by the given interpolation parameter value alpha
	 * (between 0 and 1).
	 *
	 * @param source the initial state for the interpolation
	 * @param target the final state for the interpolation
	 * @param alpha the interpolation parameter
	 */
	void interpolate(const VisComponentState& source,
		const VisComponentState& target, float alpha);

	// DEBUGGING
	/**
	 * Prints the data in the current state for debugging purposes.
	 */
	void print();
};

#endif  // VISCOMPONENTSTATE_H
